package com.example.bysj.Service;
//201902104061徐中堂
import com.example.bysj.Dao.GraduateProjectSourceDao;
import com.example.bysj.domain.GraduateProjectCategory;
import com.example.bysj.domain.GraduateProjectSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
//声明一个业务处理类
@Service("GraduateProjectSourceService")
//@Transactional注解：可以用在方法上和类上，用在类上代表这个类的所有公共非静态方法都将启用事务功能。
@Transactional(isolation = Isolation.READ_COMMITTED, propagation = Propagation. REQUIRED)
public class GraduateProjectSourceService {
    @Autowired
    private GraduateProjectSourceDao graduateProjectSourceDao;

    //添加
    public Boolean add(GraduateProjectSource graduateProjectCategory){
        return graduateProjectSourceDao.add(graduateProjectCategory);
    }
    //根据id查找
    public GraduateProjectSource find(int id){
        GraduateProjectSource graduateProjectSource = graduateProjectSourceDao.find(id);
        return graduateProjectSource;
    }
    //查找全部
    public List<GraduateProjectSource> findAll(){
        List<GraduateProjectSource> graduateProjectSources = graduateProjectSourceDao.findAll();
        return graduateProjectSources;
    }
    //修改
    public Boolean update(GraduateProjectSource graduateProjectSource){
        return graduateProjectSourceDao.update(graduateProjectSource);
    }
    //删除
    public Boolean delete(int id){
        return graduateProjectSourceDao.delete(id);
    }
}
